package com.zhang.util;

import java.util.concurrent.ThreadLocalRandom;

public class CodeUtils {
    private CodeUtils(){}
    public static String getCode(){
        String nums="0123456789";
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 4; i++) {
            int index = ThreadLocalRandom.current().nextInt(0, 10);
            sb.append(nums.charAt(index));
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        System.out.println(getCode());
    }
}
